#include "helper.h"

int Random(int Min, int Max)
{
    if (Min > Max)
    {
        int Temp = Min;
        Min = Max;
        Max = Temp;
    }
    return ((qrand() % (Max - Min + 1)) + Min);
}

quint16 GetProductClassEnum( QString a_strProductClass )
{   
    if (a_strProductClass == "APPAREL")
        return APPAREL;    
    if (a_strProductClass == "AUTOMOBILE")
        return AUTOMOBILE;
    if (a_strProductClass == "BATH_SUPPLY")
        return BATH_SUPPLY;
    if (a_strProductClass == "CHEMICAL_PRODUCT")
        return CHEMICAL_PRODUCT;
    if (a_strProductClass == "BEVERAGE")
        return BEVERAGE;
    if (a_strProductClass == "COMPUTER")
        return COMPUTER;
    if (a_strProductClass == "COSMETIC")
        return COSMETIC;
    if (a_strProductClass == "DESSERT")
        return DESSERT;
    if (a_strProductClass == "DRUGS")
        return DRUGS;
    if (a_strProductClass == "ELECTRONIC")
        return ELECTRONIC;
    if (a_strProductClass == "FOOD")
        return FOOD;
    if (a_strProductClass == "FOOTWEAR")
        return FOOTWEAR;
    if (a_strProductClass == "FURNITURE")
        return FURNITURE;
    if (a_strProductClass == "JEWELLERY")
        return JEWELLERY;
    if (a_strProductClass == "LEATHER")
        return LEATHER;
    if (a_strProductClass == "PHOTOGRAPHY")
        return PHOTOGRAPHY;
    if (a_strProductClass == "SEMI_PRODUCT")
        return SEMI_PRODUCT;
    if (a_strProductClass == "SNACKS")
        return SNACKS;
    if (a_strProductClass == "SPORT_EQUIP")
        return SPORT_EQUIP;
    if (a_strProductClass == "TOBACCO")
        return TOBACCO;
    if (a_strProductClass == "TOY_VIDEO_GAME")
        return TOY_VIDEO_GAME;
    if (a_strProductClass == "WATCH")
        return WATCH;
    if (a_strProductClass == "FARM")
        return FARM;

    return -1;
}

quint16 GetProductTypeEnum( QString a_strProductType )
{

    if (a_strProductType == "AIRCOND")
        return AIRCOND;

    if (a_strProductType == "BACKPACK")
        return BACKPACK;

    if (a_strProductType == "BATH_LOTION")
        return BATH_LOTION;

    if (a_strProductType == "BED")
        return BED;

    if (a_strProductType == "BOTTLED_MILK")
        return BOTTLED_MILK;

    if (a_strProductType == "BREAD")
        return BREAD;

    if (a_strProductType == "CAKES")
        return CAKES;

    if (a_strProductType == "CAMERA")
        return CAMERA;

    if (a_strProductType == "CAMERA_FILM")
        return CAMERA_FILM;

    if (a_strProductType == "CANNED_CORN")
        return CANNED_CORN;

    if (a_strProductType == "CANNED_SOUP")
        return CANNED_SOUP;

    if (a_strProductType == "CAR")
        return CAR;

    if (a_strProductType == "CHAIR")
        return CHAIR;

    if (a_strProductType == "CHEWING_GUM")
        return CHEWING_GUM;

    if (a_strProductType == "CHOCOLATE_BAR")
        return CHOCOLATE_BAR;

    if (a_strProductType == "CIGARETTES")
        return CIGARETTES;

    if (a_strProductType == "CIGARS")
        return CIGARS;

    if (a_strProductType == "COLA")
        return COLA;

    if (a_strProductType == "COLD_TABLET")
        return COLD_TABLET;

    if (a_strProductType == "COOKIES")
        return COOKIES;

    if (a_strProductType == "CORN_FLAKES")
        return CORN_FLAKES;

    if (a_strProductType == "COUGH_SYRUP")
        return COUGH_SYRUP;

    if (a_strProductType == "DESKTOP_COMPUTER")
        return DESKTOP_COMPUTER;

    if (a_strProductType == "DETERGENT")
        return DETERGENT;

    if (a_strProductType == "EGGS")
        return EGGS;

    if (a_strProductType == "ELEGANT_WATCH")
        return ELEGANT_WATCH;

    if (a_strProductType == "EYE_SHADOW")
        return EYE_SHADOW;

    if (a_strProductType == "FROZEN_BEEF")
        return FROZEN_BEEF;

    if (a_strProductType == "FROZEN_CHICKEN")
        return FROZEN_CHICKEN;

    if (a_strProductType == "FROZEN_LAMB")
        return FROZEN_LAMB;

    if (a_strProductType == "FROZEN_PORK")
        return FROZEN_PORK;

    if (a_strProductType == "FRUIT_SNACKS")
        return FRUIT_SNACKS;

    if (a_strProductType == "GOLD_RING")
        return GOLD_RING;

    if (a_strProductType == "GOLF_CLUBS")
        return GOLF_CLUBS;

    if (a_strProductType == "GRAPE_JUICE")
        return GRAPE_JUICE;

    if (a_strProductType == "HAIR_COLOR")
        return HAIR_COLOR;

    if (a_strProductType == "HANDHELD_GAME_DEVICE")
        return HANDHELD_GAME_DEVICE;

    if (a_strProductType == "HEADACHE_PILLS")
        return HEADACHE_PILLS;

    if (a_strProductType == "HI_FI")
        return HI_FI;

    if (a_strProductType == "ICE_CREAM")
        return ICE_CREAM;

    if (a_strProductType == "IN_LINE_SKATES")
        return IN_LINE_SKATES;

    if (a_strProductType == "JEANS")
        return JEANS;

    if (a_strProductType == "LEATHER_BAG")
        return LEATHER_BAG;

    if (a_strProductType == "LEATHER_BELT")
        return LEATHER_BELT;

    if (a_strProductType == "LEATHER_BRIEFCASE")
        return LEATHER_BRIEFCASE;

    if (a_strProductType == "LEATHER_JACKET")
        return LEATHER_JACKET;

    if (a_strProductType == "LEATHER_WALLET")
        return LEATHER_WALLET;

    if (a_strProductType == "LIPSTICK")
        return LIPSTICK;

    if (a_strProductType == "MEDIA_PLAYER")
        return MEDIA_PLAYER;

    if (a_strProductType == "MP3_PLAYER")
        return MP3_PLAYER;

    if (a_strProductType == "MICROWAVE")
        return MICROWAVE;

    if (a_strProductType == "MOBILE_PHONE")
        return MOBILE_PHONE;

    if (a_strProductType == "MOTORCYCLE")
        return MOTORCYCLE;

    if (a_strProductType == "NOTEBOOK_COMPUTER")
        return NOTEBOOK_COMPUTER;

    if (a_strProductType == "PERFUME")
        return PERFUME;

    if (a_strProductType == "PRINTER")
        return PRINTER;

    if (a_strProductType == "SANDALS")
        return SANDALS;

    if (a_strProductType == "SHAMPOO")
        return SHAMPOO;

    if (a_strProductType == "SHOES")
        return SHOES;

    if (a_strProductType == "SILVER_NECKLACE")
        return SILVER_NECKLACE;

    if (a_strProductType == "SOAP")
        return SOAP;

    if (a_strProductType == "SOCKS")
        return SOCKS;

    if (a_strProductType == "SOFA")
        return SOFA;

    if (a_strProductType == "SPORT_SHOES")
        return SPORT_SHOES;

    if (a_strProductType == "SPORT_WATCH")
        return SPORT_WATCH;

    if (a_strProductType == "SWEATER")
        return SWEATER;

    if (a_strProductType == "TABLET_COMPUTER")
        return TABLET_COMPUTER;

    if (a_strProductType == "TELEVISION")
        return TELEVISION;

    if (a_strProductType == "TOILET_CLEANER")
        return TOILET_CLEANER;

    if (a_strProductType == "TOOTHPASTE")
        return TOOTHPASTE;

    if (a_strProductType == "TOY_RACING_CAR")
        return TOY_RACING_CAR;

    if (a_strProductType == "VIDEO_CAMERA")
        return VIDEO_CAMERA;

    if (a_strProductType == "VIDEO_GAME_CONSOLE")
        return VIDEO_GAME_CONSOLE;

    if (a_strProductType == "VIDEO_RECORDER")
        return VIDEO_RECORDER;

    if (a_strProductType == "WINE")
        return WINE;

    if (a_strProductType == "YOGURT")
        return YOGURT;

    if (a_strProductType == "CAR_BODY")
        return CAR_BODY;
    if (a_strProductType == "COCONUT_OIL")
        return COCONUT_OIL;
    if (a_strProductType == "CORN_SYRUP")
        return CORN_SYRUP;
    if (a_strProductType == "CPU")
        return CPU;
    if (a_strProductType == "DYESTUFF")
        return DYESTUFF;
    if (a_strProductType == "ELECTRONIC_COMP")
        return ELECTRONIC_COMP;
    if (a_strProductType == "ENGINE")
        return ENGINE;
    if (a_strProductType == "FLOUR")
        return FLOUR;
    if (a_strProductType == "GLASS")
        return GLASS;
    if (a_strProductType == "LINEN")
        return LINEN;
    if (a_strProductType == "PAPER")
        return PAPER;
    if (a_strProductType == "PLASTIC")
        return PLASTIC;
    if (a_strProductType == "POLYSTER")
        return POLYSTER;
    if (a_strProductType == "SILICON")
        return SILICON;
    if (a_strProductType == "STEEL")
        return STEEL;
    if (a_strProductType == "TEXTILES")
        return TEXTILES;
    if (a_strProductType == "WHEAT")
        return WHEAT;
    if (a_strProductType == "WHEEL_TIRE")
        return WHEEL_TIRE;
    if (a_strProductType == "CITRIC_ACID")
        return CITRIC_ACID;


    return -1;

}